[refactor] Split the 4,467-line lib.rs into domain modules - #273
Closed
annamary224411-sudo wants to merge 2 commits into
Closed
[refactor] Split the 4,467-line lib.rs into domain modules#273annamary224411-sudo wants to merge 2 commits into
annamary224411-sudo wants to merge 2 commits into
Conversation
…into-domain-modules refactor: split large monolithic lib.rs into domain modules
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
contracts/marketxcontract by splitting the single 4,467-linelib.rsinto focused domain modules.Contracttype, exported function names, events, and types.Linked Issue
Closes #261
CI Checklist
Before requesting review, confirm all required checks pass locally:
cargo fmt --all -- --checkcargo clippy --all-targets -- -D warningscargo test./scripts/build_wasm.sh— blocked by the local Rust toolchain because thewasm32v1-nonetarget is not installed.Notes for Reviewers
Motivation
lib.rsinto focused, reviewable domain modules to reduce merge conflicts and speed onboarding.Contracttype identical while moving implementation code into logical files covering escrow lifecycle, admin, fees, arbiters, milestones, group buys, time-locks, mediation, multi-arbiter voting, token controls, and utilities.Description
Replaced the large
contracts/marketx/src/lib.rsimplementation with a compact root that declares and re-exports modules and types while retaining a single#[contract] pub struct Contract;entrypoint.Split the implementation into domain files under
contracts/marketx/src/:adminarbitersescrowfeesgroup_buyslifecyclemediationmilestonesmulti_arbitertime_lockstoken_controlsutilitiesKept the existing
errorsandtypesmodules in place.Moved
tarpaulin.rsout of the contract crate intotools/tarpaulin.rs.Deleted the unused
Automation.rs.Adjusted helper visibility to
pub(crate)where required so internal modules can share implementation helpers without unnecessarily expanding the public API.Verified public API parity by comparing exported
pub fnnames before and after the refactor.Preserved existing events and types with no public function renames or intentional API changes.
Commit:
refactor: split contract into domain modulesTesting
cargo fmt --all -- --check— passed.cargo clippy --all-targets -- -D warnings— passed with no warnings.cargo test— passed: 128 unit tests + 2 integration tests../scripts/build_wasm.sh— could not complete in the current environment because thewasm32v1-noneRust target is not installed. The toolchain reportsE0463: can't find crate for coreand indicates thatrustup target add wasm32v1-noneis required.The WASM build failure appears to be an environment/toolchain setup issue rather than a compilation error in the refactored contract.